package com.wpml.juc;

import java.util.concurrent.TimeUnit;

/**
 * @Description
 * @Date 2021-07-23
 * @Author wangpei
 **/
public class JUCTest {

    public static void main(String[] args) {
        /*Thread t = new Thread(() -> {
            System.out.println(".... start");
            try {
                TimeUnit.SECONDS.sleep(20);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            System.out.println(".... end");
        });

        t.start();

        try {
            TimeUnit.SECONDS.sleep(2);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        t.interrupt();*/


        Thread thread = new Thread(() -> {
            while (true) {

            }
        });

        thread.start();

        try {
            TimeUnit.SECONDS.sleep(2);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        thread.interrupt();
    }
}
